package com.up.stores.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.up.stores.entity.Brand;
import com.up.stores.mapper.BrandMapper;
import com.up.stores.service.IBrandService;
import io.swagger.models.auth.In;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;
@Service
public class BrandServiceImpl implements IBrandService {
    @Autowired
    BrandMapper brandMapper;
    @Override
    public List<Brand> GetAllBrand() {
        QueryWrapper<Brand>queryWrapper=new QueryWrapper<>();
        List<Brand>brandList=new ArrayList<>();
        brandList=brandMapper.selectList(null);
        return brandList;
    }

    @Override
    public String  getBrandIdByName(String name) {
        QueryWrapper<Brand>queryWrapper=new QueryWrapper<>();
        queryWrapper.eq("brand_name",name);
        String  id=brandMapper.selectOne(queryWrapper).getBrandId().toString();
        return id;
    }
}
